<template>
  <div class="parsing-wrapper">
    <div class="parsing-header">
      <div class="testing" v-if="parsing_data.level == 1">{{ `考点：${parsing_data.points}` }}</div>
      <div class="parsing-answer">
        <span class="label">正确答案：</span>
        <template v-if="parsing_data.question_type == 5">
          <div class="item">
            <span v-for="(item, index) in parsing_data.answer" :key="index">{{
              `(${index + 1})${item}`
            }}</span>
          </div>
        </template>
        <div
          class="item"
          v-else-if="parsing_data.question_type == 8"
          v-html="parsing_data.answer.toString()"
        ></div>
        <div class="item" v-else>{{ `${parsing_data.answer}` }}</div>
      </div>
    </div>
    <div class="parsing-footer">
      <span class="key">解析:</span>
      <div v-html="parsing_data.analyze" class="content"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    // 解析数据
    parsing_data: {
      type: Object,
      default: function() {
        return {}
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.parsing-wrapper {
  margin-top: 24px;
  .parsing-header {
    display: flex;
    .testing {
      font-size: 14px;
      font-weight: 400;
      color: $text-color-secondary;
      line-height: 20px;
      margin-right: 20px;
      min-width: 150px;
    }
  }
  .parsing-answer {
    flex: 1;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    @include clearfix();
    .label {
      float: left;
      color: $text-color-free;
    }
    .item {
      color: $text-color-import;
      ::v-deep * {
        margin: 0;
        padding: 0;
      }
      & + .item {
        margin-left: 5px;
      }
    }
  }
  .parsing-footer {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 400;
    color: $text-color-secondary;
    line-height: 24px;
    @include clearfix();
    .key {
      float: left;
    }
    .content ::v-deep * {
      margin: 0;
      padding: 0;
    }
    .content ::v-deep img {
      max-width: 100%;
    }
  }
}
</style>
